package com.solcoo.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Repository;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.solcoo.pojo.Recommend;

@Repository
public class RecommendDao {

	@Resource
	private SqlMapClient sqlMapClient;

	public void addRecommend(String telephone, String recommended, String rdtype, String apptype) throws Exception {
		Map<String, Object> param = new HashMap<String, Object>();
		param.put("telephone", telephone);
		param.put("recommended", recommended);
		param.put("rdtype", rdtype);
		param.put("apptype", apptype);
		
		sqlMapClient.insert("addRecommend", param);
	}
	
	public List<Recommend> getRewardRecommend(String today) throws Exception {
		return (List<Recommend>)sqlMapClient.queryForList("getRewardRecommend", today);
	}
	
	public void updateRewardRecommend(Integer id) throws Exception {
		sqlMapClient.update("updateRewardRecommend", id);
	}
}